<?php

include("../../utility/connection.php");
include("../../model/mToko.php");
session_start();

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $NamaToko = trim(mysql_real_escape_string($_POST["Editbox1"]));
    $Alamat1Toko = trim(mysql_real_escape_string($_POST["Editbox2"]));
    $Alamat2Toko = trim(mysql_real_escape_string($_POST["Editbox3"]));
    $KelurahanToko = trim(mysql_real_escape_string($_POST["Editbox4"]));
    $KecamatanToko = trim(mysql_real_escape_string($_POST["Editbox5"]));
    $KotaToko = trim(mysql_real_escape_string($_POST["Editbox6"]));
    $PropinsiToko = trim(mysql_real_escape_string($_POST["Editbox7"]));
    $KodePosToko = trim(mysql_real_escape_string($_POST["Editbox8"]));
    $TeleponToko = trim(mysql_real_escape_string($_POST["Editbox9"]));
    $EmailToko = trim(mysql_real_escape_string($_POST["Editbox10"]));
    $CPToko = trim(mysql_real_escape_string($_POST["Editbox11"]));
    $MottoToko = trim(mysql_real_escape_string($_POST["Editbox12"]));


    $DeleteInfo = fnDeleteInfo();
    $Message = '';
    if ($DeleteInfo) {
        fnInsertInfo($NamaToko, $Alamat1Toko, $Alamat2Toko, $KelurahanToko, $KecamatanToko, $KotaToko
                , $PropinsiToko, $KodePosToko, $TeleponToko, $EmailToko, $CPToko, $MottoToko);
        $Message = 'Proses Simpan Berhasil! Silakan tutup browser dan buka kembali untuk melihat hasil penyimpanan.';
    } else {
        $Message = 'Proses Simpan Gagal!';
    }
    $_SESSION['message'] = $Message;
    header("location: ../mstToko.php");
}
?>
